from src.conf.base_conf import BaseConf


class RobotConf(BaseConf):
    """机器人配置文件"""
    def __init__(self, path: str):
        super().__init__(path)

    def _reload_from_dict(self, conf_dict: dict):
        self.on = conf_dict.get("启用机器人", True)
        # 解析域名获取ip地址
        self.app_id = str(conf_dict.get("AppID", "0"))
        self.secret = conf_dict.get("AppSecret", "xxx")
        self.owners = conf_dict.get("管理员ID", ["3893416516573034874"])
        self.allow_group_admin = conf_dict.get("授权群组管理员", False)
        self.group = conf_dict.get("群组ID", "")

    def _check(self):
        pass

    def __str__(self):
        conf_dict = {
            "启用机器人": self.on,
            "AppID": self.app_id,
            "AppSecret": self.secret,
            "管理员ID": self.owners,
            "授权群组管理员": self.allow_group_admin,
            "群组ID": self.group,
            "描述": "QQ机器人相关的配置项在此处修改"
        }
        return self._dict_to_str(conf_dict)
